package com.brainshare.web.controller.an;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.net.URLDecoder;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.brainshare.an.domain.*;
import com.brainshare.an.service.*;
import com.brainshare.common.utils.DateUtils;
import com.brainshare.common.utils.StringUtils;
import com.brainshare.framework.aspectj.LogAspect;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.security.AlgorithmParameters;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.UUID;



@Controller
@RequestMapping("/an/platform")
public class CallBackController {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());


    @Autowired
    private IAnCallBackService anCallBackService;

    /**
     * 接收京师端回调
     *
     * @param requestObj
     * @return
     */
    @PostMapping(value = "/callback")
    public @ResponseBody String callBack(@RequestBody JSONObject requestObj) {
        JSONObject object = anCallBackService.refreshUserReport(requestObj);
        return object.toJSONString();
    }


}
